package com.wangyadong.hobby.thread;

import java.util.stream.IntStream;

public class InterruptingWorkThread {

    private static volatile   int count = 0;

    public static void main(String[] args) throws InterruptedException {
        IntStream.range(0, 1000).forEach(i -> {
            Thread thread = new Thread(() -> {
                int i1 = count++;
                System.out.println(i1);
            });
            thread.start();
        });
        Thread.sleep(2);

        System.out.println("--->" + count);

    }
}
